package com.mkh.st.admin.feign;

import com.mkh.st.admin.api.dto.SysCompanyIdDTO;
import com.mkh.st.admin.api.entity.SysCompanyInfo;
import com.mkh.st.admin.api.feign.ISysCompanyProvider;
import com.mkh.st.admin.api.vo.SelectCompanyVO;
import com.mkh.st.admin.service.SysCompanyInfoService;
import com.mkh.st.common.core.util.R;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@AllArgsConstructor
public class SysCompanyProvider implements ISysCompanyProvider {

	private final SysCompanyInfoService sysCompanyInfoService;


	@Override
	public R<List<SysCompanyInfo>> getCompanyList(SysCompanyIdDTO dto) {

		return R.ok(sysCompanyInfoService.getCompanyList(dto));
	}

	@Override
	public R<List<SelectCompanyVO>> getCompanyCodeList(String menuCode) {
		return R.ok(sysCompanyInfoService.companyInfoList(menuCode));
	}

	@Override
	public R<SelectCompanyVO> getCompanyInfoByName(String name) {
		return R.ok(sysCompanyInfoService.getCompanyInfoByName(name));
	}

    @Override
    public R<SelectCompanyVO> getCompanyInfoById(Long companyId) {
		return R.ok(sysCompanyInfoService.getCompanyInfoById(companyId));
    }
}
